# _ * _ coding:utf-8  _ * _

yh_user=[{"yh_mc":"张山","yh_zh":"0000000000000000000","yh_mm":"000000","yh_je":100000},
         {"yh_mc":"李四","yh_zh":"1111111111111111111","yh_mm":"111111","yh_je":200000},
         {"yh_mc":"王五","yh_zh":"2222222222222222222","yh_mm":"222222","yh_je":300000},
         {"yh_mc":"赵六","yh_zh":"3333333333333333333","yh_mm":"333333","yh_je":400000}]
def yh_dljm():
    print("="*14,"CSDN银行登录界面","="*14)
    print("")
    print("")
    print('               ','ATM登录')
    print('')
    print('')
    print("=" * 14, "CSDN银行登录界面", "=" * 14)
def yh_yzjm(dlzh,dlmm):
    for i in range(len(yh_user)):
        if dlzh==yh_user[i]["yh_zh"] and dlmm==yh_user[i]["yh_mm"]:
            return i
def yh_czjm():
    print("")
    print("{0:4}{1:8}{2:8}{3:10}".format("", '1.取款', '2.存款', "3.修改密码"))
    print('')
    print('{0:6}{1:10}{2:6}'.format("", '4.查询余额', '5.退出系统'))
def user_qk(c):
    if int(c)<yh_user[k]["yh_je"]:
        yh_user[k]["yh_je"] = yh_user[k]["yh_je"] - int(c)
    else:
        print("您的余额不足")
def user_ck(d):
    yh_user[k]["yh_je"] = yh_user[k]["yh_je"] + int(d)
def user_xgmm(oldmm,xinmm1,xinmm2):
    if oldmm==yh_user[k]["yh_mm"]:
        if xinmm1==xinmm2:
            yh_user[k]["yh_mm"]=xinmm1
            print("密码修改成功")
        else:
            print("两次密码不一致，修改错误")
    else:
        print("旧密码错误，密码修改错误")
def user_yecx():
    print('您的账户余额是：',yh_user[k]["yh_je"])

chance=3
while True:
    yh_dljm()
    print('')
    a1=input("请输入您的登录账号：\n")
    a2 = input("请输入您的登录密码：\n")
    k=yh_yzjm(a1,a2)
    if k != None:
        while True:
            yh_czjm()
            print('')
            key_id=input("请输入您需要的操作：\n")
            if key_id=="1":
                print('')
                b1=input("请输入您要取款的金额：\n")
                user_qk(b1)
            elif key_id=="2":
                print('')
                b2=input("请输入您要存款的金额：\n")
                user_ck(b2)
            elif key_id=="3":
                print('')
                b3=input("请输入您的旧密码：\n")
                b4=input("请输入您的新密码：\n")
                b5=input("请再次输入您的新密码：\n")
                user_xgmm(b3,b4,b5)
            elif key_id=="4":
                print('')
                user_yecx()
            elif key_id=="5":
                print("欢迎您的再次光临，谢谢！")
                break
            else:
                print("您输入的选择无效，请重新输入，谢谢")

    else:
        if chance>1:
            print('您还有', chance - 1, "次输入机会")
            chance-=1
        else:
            break

